package com.heqiang.spring.bean;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class PropertyValues {

    private final List<PropertyValue> propertyValueList = new ArrayList<>();

    public void addProperValue(PropertyValue value) {
        this.propertyValueList.add(value);
    }

    public PropertyValue[] getProperValues() {
        return this.propertyValueList.toArray(new PropertyValue[0]);
    }

    public PropertyValue getProperValue(String name) {
        for(PropertyValue value : this.propertyValueList) {
            if (Objects.equals(value.getName(),name)) {
                return value;
            }
        }
        return null;
    }
}
